All sites and drugs

Drug A

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001002
ETS(quantity ~ season(method = “N”)) l 162.3565708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.63355 0.0614688
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 0.6160404 0.1679878 3.667174 0.0002858
ARIMA(quantity) ma1 -0.6055922 0.1698636 -3.565169 0.0004173
ARIMA(quantity) ma2 0.1340922 0.0598298 2.241227 0.0256759
ARIMA(quantity) sar1 0.0981877 0.0639542 1.535283 0.1256726
ARIMA(quantity) constant 56.3162905 3.3440977 16.840504 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 6.277749 0.7914132
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -17.955 99.947 88.679 -Inf Inf 0.71325
ETS(quantity ~ season(method = “N”)) Test -10.876 104.840 91.000 -Inf Inf 0.73192
prophet(quantity) Test 10.452 105.970 102.290 -Inf Inf 0.82271
SNAIVE(quantity) Test -92.667 122.390 104.330 -Inf Inf 0.83916
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -1.0351 54.794 36.070 -Inf Inf 1.05120
ETS(quantity ~ season(method = “N”)) Test -1.6049 56.040 37.181 -Inf Inf 1.08360
prophet(quantity) Test -1.2504 55.974 35.661 NaN Inf 1.03930
SNAIVE(quantity) Test -2.3333 57.196 25.667 -Inf Inf 0.74802
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -25.20535 117.9132 100.31953 -Inf Inf 0.8167953 -0.0704047
ETS(quantity ~ season(method = “N”)) Test -24.24783 117.2160 98.46498 -Inf Inf 0.8016957 -0.1404514
prophet(quantity) Test -15.77041 513.4691 232.46738 -Inf Inf 1.8927348 0.0637362
SNAIVE(quantity) Test -10.51852 162.4074 131.40741 -Inf Inf 1.0699108 -0.0374186
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 25.2303109 95.69321 56.43252 NaN Inf 1.6350261 0.1158871
ETS(quantity ~ season(“N”)) Test -3.7595861 50.47848 37.66326 -Inf Inf 1.0912222 -0.2326012
prophet(quantity) Test -0.7656823 44.15451 27.73432 NaN Inf 0.8035496 0.0899582
SNAIVE(quantity) Test -10.6666667 86.64102 50.00000 -Inf Inf 1.4486559 -0.1252455

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l 2018.9770

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 271.4111 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5644956 0.0443110 -35.307164 0.0000000
ARIMA(quantity) ma2 0.5815256 0.0442398 13.144845 0.0000000
ARIMA(quantity) sma1 0.1117924 0.0564947 1.978812 0.0486708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 56.09459 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -269.200 1095.30 815.82 -74.093 93.163 1.3412
ETS(quantity ~ season(method = “N”)) Test -237.780 908.66 722.17 -61.588 78.739 1.1873
prophet(quantity) Test -207.760 918.26 722.93 -61.027 80.057 1.1885
SNAIVE(quantity) Test 10.833 1837.60 1650.20 -83.329 150.260 2.7130
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -36.0820 434.43 347.90 -Inf Inf 0.96973
ETS(quantity ~ season(method = “N”)) Test -19.4260 450.48 350.16 -Inf Inf 0.97604
prophet(quantity) Test -4.2805 474.53 323.75 NaN Inf 0.90242
SNAIVE(quantity) Test 185.2100 479.98 262.02 -Inf Inf 0.73037
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 16.89737 671.6956 478.1925 -12.580915 34.97243 0.7984274 -0.1803572
ETS(quantity ~ season(method = “N”)) Test -383.01074 668.8489 561.4917 -38.504087 45.00228 0.9375103 -0.4464899
prophet(quantity) Test -886.02419 1829.0925 1099.5580 -67.867259 75.88472 1.8359077 0.4161076
SNAIVE(quantity) Test 65.74074 631.5291 483.0741 -5.520615 33.15133 0.8065781 -0.2562749
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 284.57494 1896.9388 854.1100 NaN Inf 2.378887 -0.0003884
ETS(quantity ~ season(“N”)) Test -24.80003 573.8836 382.8588 -Inf Inf 1.066347 0.0261571
prophet(quantity) Test 299.79875 1474.7287 601.7404 NaN Inf 1.675981 0.0353826
SNAIVE(quantity) Test 98.41667 778.5898 411.0833 -Inf Inf 1.144959 0.0780889

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l 3297.9622

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 159.7713 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5802277 0.0421181 -37.519010 0
ARIMA(quantity) ma2 0.6097934 0.0439426 13.877053 0
ARIMA(quantity) sma1 0.3502639 0.0583689 6.000861 0

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 64.2106 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -160.180 1592.4 1351.3 -40.251 63.339 1.6235
ETS(quantity ~ season(method = “N”)) Test 14.938 1447.0 1225.5 -29.304 53.342 1.4723
prophet(quantity) Test 121.120 1442.7 1221.5 -23.718 49.736 1.4676
SNAIVE(quantity) Test 10.667 2195.8 1868.0 -48.360 90.024 2.2443
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -21.0540 707.47 528.15 -Inf Inf 1.24260
ETS(quantity ~ season(method = “N”)) Test -6.6455 698.07 514.96 -Inf Inf 1.21150
prophet(quantity) Test 11.2070 639.48 425.19 NaN Inf 1.00030
SNAIVE(quantity) Test 303.1900 724.97 387.52 -40.53 142.2 0.91172
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -149.63190 955.9126 827.3318 -21.87522 37.91886 1.005802 -0.5012751
ETS(quantity ~ season(method = “N”)) Test -206.02724 1229.1067 1055.5196 -34.19600 52.75269 1.283213 -0.5622976
prophet(quantity) Test -21.45090 4593.8719 2344.8879 -27.10815 105.37410 2.850721 -0.0557857
SNAIVE(quantity) Test -98.14815 1323.9697 1064.3704 -24.69294 47.69068 1.293973 -0.3847595
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -56.61774 434.3618 362.5953 -Inf Inf 0.8628774 0.0660133
ETS(quantity ~ season(“N”)) Test -123.63958 372.2577 328.5389 -Inf Inf 0.7818323 -0.3049381
prophet(quantity) Test 11.84012 383.6259 263.0213 NaN Inf 0.6259185 0.2713956
SNAIVE(quantity) Test -107.25000 596.0340 382.5833 -Inf Inf 0.9104433 0.0447512

Drug B

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.139557
ETS(quantity ~ season(method = “N”)) l 59.925456

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 20.98792 0.021178
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 0.1505062 0.0881543 1.707304 0.0896019
ARIMA(quantity) ma1 -0.8930176 0.0399560 -22.350011 0.0000000
ARIMA(quantity) sma1 -0.1339187 0.0840958 -1.592453 0.1131516

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 17.7895 0.05862
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 87.756 110.140 87.756 40.53900 40.539 1.14070
ETS(quantity ~ season(method = “N”)) Test 19.851 68.637 52.716 0.78951 24.988 0.68522
prophet(quantity) Test 80.355 100.680 80.355 37.39700 37.397 1.04450
SNAIVE(quantity) Test 118.830 136.360 118.830 59.71900 59.719 1.54460
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 11.7560 38.837 26.066 -Inf Inf 1.6681
ETS(quantity ~ season(method = “N”)) Test 7.9533 37.947 26.247 -Inf Inf 1.6797
prophet(quantity) Test 11.0910 35.042 21.390 -Inf Inf 1.3688
SNAIVE(quantity) Test 12.7620 36.109 21.238 -Inf Inf 1.3591
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -13.22444 55.25793 46.09315 -122.218255 142.26525 0.6141584 0.1542215
ETS(quantity ~ season(method = “N”)) Test -16.76031 58.00306 47.60042 -132.908220 150.93329 0.6342417 0.0649896
prophet(quantity) Test -75.29404 246.32037 131.09194 -396.326206 454.67008 1.7467066 -0.1221946
SNAIVE(quantity) Test 28.90909 68.73136 48.90909 -2.714454 61.21138 0.6516787 -0.0892070
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -16.298387 21.67009 16.29839 -Inf Inf 1.0743482 0.0319153
ETS(quantity ~ season(“N”)) Test -5.537031 12.71952 12.20404 -Inf Inf 0.8044592 0.0265180
prophet(quantity) Test -18.930928 30.64683 19.22381 NaN Inf 1.2671848 -0.1023979
SNAIVE(quantity) Test -9.500000 25.28834 18.83333 -Inf Inf 1.2414454 -0.4487179

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.1100328
ETS(quantity ~ season(method = “N”)) l 156.2431110

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 46.14766 1.3e-06
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.0477872 0.0696255 -15.048902 0.0000000
ARIMA(quantity) ma2 0.2344245 0.0744485 3.148816 0.0019296
ARIMA(quantity) sma1 0.2730468 0.0902235 3.026339 0.0028512

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 13.49332 0.1973817
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 69.035 100.660 74.455 26.3140 62.444 0.69958
ETS(quantity ~ season(method = “N”)) Test 57.970 95.708 72.598 -9.4382 88.077 0.68213
prophet(quantity) Test -11.603 76.511 70.608 -128.8600 155.570 0.66343
SNAIVE(quantity) Test -49.000 82.704 71.333 -161.1200 170.090 0.67025
Daily data
## Warning in sqrt(diag(best$var.coef)): NaNs produced

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 4.16800 27.855 17.880 -Inf Inf 0.59479
ETS(quantity ~ season(method = “N”)) Test 15.12300 31.340 15.795 NaN Inf 0.52542
prophet(quantity) Test 5.22030 27.171 21.438 NaN Inf 0.71315
SNAIVE(quantity) Test -0.80952 36.635 22.810 -Inf Inf 0.75878
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 27.991157 122.3278 106.09330 -110.8304 156.4304 1.0040912 0.1565226
ETS(quantity ~ season(method = “N”)) Test 26.952283 101.9112 85.27137 -152.5941 188.9552 0.8070277 0.4519125
prophet(quantity) Test 3.013169 129.0651 108.70019 -221.6250 258.5854 1.0287634 0.1741823
SNAIVE(quantity) Test -43.083333 133.4881 126.75000 -380.0090 404.2968 1.1995910 0.5555508
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 28.67458 86.72278 51.74750 NaN Inf 1.7271659 0.0313377
ETS(quantity ~ season(“N”)) Test -6.13568 27.03736 21.11563 -Inf Inf 0.7047722 -0.1100202
prophet(quantity) Test 32.13494 96.29395 52.67246 NaN Inf 1.7580382 0.0057382
SNAIVE(quantity) Test 10.00000 25.81804 18.00000 50 100 0.6007824 0.1591024

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.124371
ETS(quantity ~ season(method = “N”)) l 898.440269

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 15.57969 0.112313
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 1.0313879 0.0987790 10.4413722 0.0000000
ARIMA(quantity) ar2 -0.0661262 0.0897797 -0.7365376 0.4623786
ARIMA(quantity) ma1 -0.8414622 0.0537101 -15.6667286 0.0000000
ARIMA(quantity) sar1 0.2504092 0.0907798 2.7584234 0.0064183
ARIMA(quantity) constant 21.1296806 2.2429951 9.4202972 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 15.58525 0.1121366
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 105.51000 263.09 222.54 4.0375 23.232 0.90854
ETS(quantity ~ season(method = “N”)) Test 0.36505 238.05 193.23 -7.4153 23.177 0.78888
prophet(quantity) Test 259.01000 350.86 313.05 20.2220 29.580 1.27810
SNAIVE(quantity) Test 412.42000 491.26 412.42 38.4530 38.453 1.68370
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 38.529 119.500 94.770 -Inf Inf 1.14030
ETS(quantity ~ season(method = “N”)) Test 11.305 140.600 112.950 -Inf Inf 1.35900
prophet(quantity) Test 26.573 77.494 54.843 -Inf Inf 0.65987
SNAIVE(quantity) Test 60.429 111.980 77.000 26.675 61.008 0.92646
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 19.277667 205.1419 133.0653 -0.5412494 15.80380 0.5415783 -0.0745924
ETS(quantity ~ season(method = “N”)) Test 26.490351 165.8133 113.2738 0.4867214 13.13922 0.4610262 0.1888127
prophet(quantity) Test 377.922408 1621.8121 836.3426 42.6686979 118.99848 3.4039295 -0.0866513
SNAIVE(quantity) Test 5.833333 305.2324 226.3333 -5.2164793 26.39360 0.9211808 0.0746847
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.7452241 107.10373 87.14089 -Inf Inf 1.0473623 -0.1114169
ETS(quantity ~ season(“N”)) Test 28.1096588 161.93995 141.41887 -Inf Inf 1.6997392 -0.2037620
prophet(quantity) Test 2.5993510 89.46422 73.17763 -Inf Inf 0.8795353 -0.6980208
SNAIVE(quantity) Test 43.0000000 97.95845 69.85714 7.329715 94.77158 0.8396258 0.0504905

Drug C

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0412606
ETS(quantity ~ season(method = “N”)) l 0.2623830

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.77709 0.0588423
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.0701466 0.0586881 -1.195245 0.2328629
ARIMA(quantity) ma1 -0.9615223 0.0226335 -42.482203 0.0000000
ARIMA(quantity) constant 0.0026204 0.0018765 1.396437 0.1635358

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.57448 0.084326
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.2857800 0.46890 0.28578 19.2700 19.270 0.39684
ETS(quantity ~ season(method = “N”)) Test 0.2930300 0.47409 0.29303 19.9170 19.917 0.40691
prophet(quantity) Test -0.0013524 0.40477 0.30228 -7.3543 23.009 0.41975
SNAIVE(quantity) Test 0.3333300 0.81650 0.66667 25.0000 58.333 0.92573
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.181280 0.34152 0.18128 Inf Inf 1.3962
ETS(quantity ~ season(method = “N”)) Test -0.040362 0.29631 0.20501 -Inf Inf 1.5790
prophet(quantity) Test -0.062591 0.28866 0.21251 -Inf Inf 1.6367
SNAIVE(quantity) Test -0.047619 0.43644 0.19048 -Inf Inf 1.4671
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0421053 0.8393013 0.5541804 -Inf Inf 0.7695355 -0.0275101
ETS(quantity ~ season(method = “N”)) Test -0.1150738 0.8592692 0.6069687 -Inf Inf 0.8428374 0.0119434
prophet(quantity) Test -0.3007699 1.6973211 1.0601304 NaN Inf 1.4720982 -0.0146589
SNAIVE(quantity) Test -0.1111111 0.9229582 0.6296296 -Inf Inf 0.8743044 0.0778867
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 0.1007468 0.6269236 0.3268215 NaN Inf 2.599233 0.0126785
ETS(quantity ~ season(“N”)) Test 0.0948670 0.5723796 0.2320933 -Inf Inf 1.845854 -0.0568424
prophet(quantity) Test 0.1826151 0.6488830 0.3160797 NaN Inf 2.513803 -0.0823068
SNAIVE(quantity) Test 0.1666667 0.5773503 0.1666667 100 100 1.325511 -0.0984848

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0510261
ETS(quantity ~ season(method = “N”)) l 0.6459055

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.51043 0.0001021
ARIMA
## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 1.1048919 0.1516446 7.286061 0.0000000
ARIMA(quantity) ar2 -0.4391590 0.1989076 -2.207855 0.0279503
ARIMA(quantity) ma1 -1.2172989 0.1320716 -9.216960 0.0000000
ARIMA(quantity) ma2 0.6420286 0.1789902 3.586947 0.0003858
ARIMA(quantity) sar1 -0.5355094 NaN NaN NaN
ARIMA(quantity) sma1 0.5853612 NaN NaN NaN
ARIMA(quantity) constant 0.3752139 0.0369474 10.155340 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 23.05706 0.0105379
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.049325 0.51020 0.49213 -Inf Inf 0.49959
ETS(quantity ~ season(method = “N”)) Test -0.018531 0.47177 0.43827 -Inf Inf 0.44491
prophet(quantity) Test 0.288300 0.56764 0.55528 -Inf Inf 0.56369
SNAIVE(quantity) Test 0.333330 0.81650 0.66667 -Inf Inf 0.67677
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.014127 0.32413 0.19897 -Inf Inf 1.04670
ETS(quantity ~ season(method = “N”)) Test 0.022134 0.32460 0.19289 -Inf Inf 1.01470
prophet(quantity) Test 0.039191 0.31361 0.18020 NaN Inf 0.94797
SNAIVE(quantity) Test -0.023810 0.51177 0.26190 -Inf Inf 1.37780
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.1710114 0.9796163 0.7320750 NaN Inf 0.7431671 -0.3364868
ETS(quantity ~ season(method = “N”)) Test -0.1108441 0.8712828 0.7075714 NaN Inf 0.7182922 -0.3562419
prophet(quantity) Test 0.3102135 2.6286350 1.2303357 NaN Inf 1.2489771 0.0609418
SNAIVE(quantity) Test -0.4814815 1.5515822 1.0740741 -Inf Inf 1.0903479 -0.3664939
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 0.4303394 0.7642420 0.4946148 NaN Inf 2.588210 -0.5597121
ETS(quantity ~ season(“N”)) Test 0.3841751 0.7525626 0.5159125 -Inf Inf 2.699656 -0.5652191
prophet(quantity) Test 0.3750273 0.7151440 0.4679030 NaN Inf 2.448433 -0.4655574
SNAIVE(quantity) Test 0.4166667 0.8660254 0.5833333 -Inf Inf 3.052455 -0.5552209

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0550134
ETS(quantity ~ season(method = “N”)) l 4.2467197

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 87.48554 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.9658033 0.0347695 -27.7773420 0.0000000
ARIMA(quantity) ma1 0.0096191 0.0432232 0.2225447 0.8240280
ARIMA(quantity) ma2 -0.8915537 0.0414954 -21.4855861 0.0000000
ARIMA(quantity) sar1 -0.1594127 0.3129469 -0.5093921 0.6108189
ARIMA(quantity) sar2 0.1753829 0.0713690 2.4574109 0.0145097
ARIMA(quantity) sma1 0.2334420 0.3155152 0.7398758 0.4599030

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 83.66213 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.64151 2.4227 1.7647 -Inf Inf 0.79338
ETS(quantity ~ season(method = “N”)) Test 0.48847 2.4071 1.7184 -Inf Inf 0.77256
prophet(quantity) Test 0.55416 2.4603 1.9927 -Inf Inf 0.89589
SNAIVE(quantity) Test 0.16667 3.1885 2.8333 -Inf Inf 1.27380
Daily data
## Warning in sqrt(diag(best$var.coef)): NaNs produced

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.1059800 0.74299 0.42298 -Inf Inf 0.67971
ETS(quantity ~ season(method = “N”)) Test 0.0486690 0.74157 0.45893 -Inf Inf 0.73748
prophet(quantity) Test -0.0026539 0.74186 0.48489 NaN Inf 0.77921
SNAIVE(quantity) Test 0.0238100 0.74001 0.40476 -Inf Inf 0.65044
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 0.4028857 2.958575 2.081972 -Inf Inf 0.9330576 -0.0199346
ETS(quantity ~ season(method = “N”)) Test 0.2098833 2.476379 1.896634 -Inf Inf 0.8499965 -0.2425449
prophet(quantity) Test -1.0498828 5.379404 2.806312 -Inf Inf 1.2576781 -0.1774882
SNAIVE(quantity) Test 0.2592593 3.226051 2.259259 -Inf Inf 1.0125108 0.0461907
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.7978619 2.9127925 1.3894084 -Inf Inf 2.2084176 -0.0962338
ETS(quantity ~ season(“N”)) Test -0.0928173 0.7227666 0.6137358 -Inf Inf 0.9755122 -0.5179068
prophet(quantity) Test -0.9396940 3.2796915 1.3324359 NaN Inf 2.1178616 -0.0166965
SNAIVE(quantity) Test 0.0833333 1.1180340 0.7500000 -Inf Inf 1.1920996 -0.6764432

Drug D

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.1177532
ETS(quantity ~ season(method = “N”)) l 7.9912120

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.48464 0.0001032
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -0.8780575 0.0323965 -27.1034327 0.0000000
ARIMA(quantity) sar1 0.0354841 0.0786125 0.4513799 0.6520441

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 36.34574 7.34e-05
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 3.9053 11.142 5.1743 -Inf Inf 0.49484
ETS(quantity ~ season(method = “N”)) Test 3.7817 11.099 5.2566 -Inf Inf 0.50272
prophet(quantity) Test -4.7007 10.285 9.4090 -Inf Inf 0.89982
SNAIVE(quantity) Test 4.6667 11.431 4.6667 100 100 0.44630
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.63313 4.3154 0.69861 -Inf Inf 0.42239
ETS(quantity ~ season(method = “N”)) Test 0.63792 4.3162 0.69405 -Inf Inf 0.41963
prophet(quantity) Test 0.93829 4.4461 1.34190 NaN Inf 0.81133
SNAIVE(quantity) Test 0.66667 4.3205 0.66667 100 100 0.40308
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -3.350528 18.35454 10.628312 NaN Inf 1.0061807 0.0928565
ETS(quantity ~ season(method = “N”)) Test -2.287967 12.84910 8.549902 -Inf Inf 0.8094180 -0.3019281
prophet(quantity) Test 17.029606 68.01474 29.324237 NaN Inf 2.7761211 0.4938372
SNAIVE(quantity) Test -3.458333 19.67337 9.625000 -Inf Inf 0.9111973 0.3929467
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 1.823933 7.611587 2.929261 NaN Inf 1.730998 -0.0458815
ETS(quantity ~ season(“N”)) Test 1.429982 6.971705 2.571545 -Inf Inf 1.519612 -0.1354480
prophet(quantity) Test 2.012822 6.207247 3.331596 NaN Inf 1.968751 0.1677690
SNAIVE(quantity) Test 0.000000 11.430952 4.666667 -Inf Inf 2.757690 0.0000000

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0807574
ETS(quantity ~ season(method = “N”)) l 17.8629306

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 26.27242 0.0033906
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.1995096 0.0747021 -2.670737 0.0079493
ARIMA(quantity) ma1 -0.8003094 0.0616738 -12.976498 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.76456 0.0797388
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 11.6770 18.153 13.893 -Inf Inf 0.43867
ETS(quantity ~ season(method = “N”)) Test 7.0046 15.509 13.833 -Inf Inf 0.43677
prophet(quantity) Test 8.1581 14.725 12.943 NaN Inf 0.40867
SNAIVE(quantity) Test 4.5000 19.803 14.167 -Inf Inf 0.44730
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 1.7259 8.3257 3.3840 -Inf Inf 0.64965
ETS(quantity ~ season(method = “N”)) Test 1.8888 8.3638 3.2537 -Inf Inf 0.62465
prophet(quantity) Test 1.2346 8.3503 4.4703 NaN Inf 0.85820
SNAIVE(quantity) Test 2.6429 8.5649 2.6429 100 100 0.50737
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -3.486690 39.14891 25.61079 -Inf Inf 0.8086348 -0.0057632
ETS(quantity ~ season(method = “N”)) Test -3.869129 28.28784 21.64749 -Inf Inf 0.6834975 -0.2157579
prophet(quantity) Test 13.745053 138.73141 59.35357 NaN Inf 1.8740287 -0.0184426
SNAIVE(quantity) Test -10.444444 41.04018 27.03704 -Inf Inf 0.8536671 -0.1136586
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 16.967734 52.97826 21.491109 NaN Inf 4.0576717 -0.0430950
ETS(quantity ~ season(“N”)) Test 1.253341 11.15908 7.142298 -Inf Inf 1.3485159 -0.0671872
prophet(quantity) Test 4.715659 22.19332 13.641277 NaN Inf 2.5755686 -0.4438870
SNAIVE(quantity) Test 4.666667 11.43095 4.666667 100 100 0.8810993 -0.2166667

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0532616
ETS(quantity ~ season(method = “N”)) l 107.9514229

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 54.70743 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.8631315 0.0787298 -10.9632122 0.0000000
ARIMA(quantity) ma1 0.0236562 0.0936657 0.2525604 0.8007671
ARIMA(quantity) ma2 -0.7615099 0.0822297 -9.2607650 0.0000000
ARIMA(quantity) ma3 -0.1759554 0.0590797 -2.9782710 0.0031161
ARIMA(quantity) sar1 0.0159874 0.0590524 0.2707316 0.7867688
ARIMA(quantity) sar2 0.1144626 0.0674947 1.6958748 0.0908643

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 37.74725 4.2e-05
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -37.0820 39.045 37.082 -Inf Inf 0.68225
ETS(quantity ~ season(method = “N”)) Test -41.1820 42.508 41.182 -Inf Inf 0.75768
prophet(quantity) Test -6.6428 12.662 10.402 NaN Inf 0.19137
SNAIVE(quantity) Test -28.0000 48.497 37.333 -Inf Inf 0.68687
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 2.2710 9.7607 2.2710 Inf Inf 0.17621
ETS(quantity ~ season(method = “N”)) Test -3.7615 10.1820 7.2165 -Inf Inf 0.55992
prophet(quantity) Test -1.3711 11.4650 7.9294 NaN Inf 0.61523
SNAIVE(quantity) Test 2.0000 9.6609 2.0000 100 100 0.15518
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -9.618011 55.7533 41.92324 -Inf Inf 0.7699190 -0.3397268
ETS(quantity ~ season(method = “N”)) Test -10.791006 45.5069 36.89630 -Inf Inf 0.6775994 -0.1251835
prophet(quantity) Test 57.231878 217.0525 95.73090 -Inf Inf 1.7580951 0.3462817
SNAIVE(quantity) Test -15.444444 78.8099 57.51852 -Inf Inf 1.0563258 -0.0885764
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning: Having 3 or more differencing operations is not recommended. Please
## consider reducing the total number of differences.
## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
## Warning: Problem with `mutate()` input `ARIMA(quantity)`.
## ℹ NaNs produced
## ℹ Input `ARIMA(quantity)` is `(function (object, ...) ...`.
## Warning in sqrt(z[[2L]] * object$sigma2): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -26.213775 98.05150 42.11526 NaN Inf 3.216833 0.0243591
ETS(quantity ~ season(“N”)) Test -2.373293 20.45453 16.39639 -Inf Inf 1.252384 -0.0963740
prophet(quantity) Test -4.913114 28.21801 21.63406 NaN Inf 1.652446 0.0110937
SNAIVE(quantity) Test 2.000000 21.41650 12.00000 -Inf Inf 0.916580 -0.2969208